package mercurius.fitness.client.rb.summary;

import java.util.ArrayList;
import java.util.HashMap;

import net.pleso.framework.client.dal.IDataColumn;
import net.pleso.framework.client.dal.IDataRow;
import net.pleso.framework.client.dal.db.IDBValue;
import net.pleso.framework.client.dal.db.types.DBInteger;
import net.pleso.framework.client.dal.db.types.DBString;
import net.pleso.framework.client.dal.impl.DataColumn;

public class Summary implements IDataRow {

	public Summary() {

	}
	
	private String durationThis = DBString.nullValue;
	private String distanceThis = DBString.nullValue;
	private String activitiesThis = DBString.nullValue;
	private String durationLast = DBString.nullValue;
	private String distanceLast = DBString.nullValue;
	private String activitiesLast = DBString.nullValue;
	private Integer totalpointsThis = DBInteger.nullValue;
	private Integer totalpointsLast = DBInteger.nullValue;
	private Integer caloriesThis = DBInteger.nullValue;
	private Integer caloriesLast = DBInteger.nullValue;
	private String z1This = DBString.nullValue;
	private String z2This = DBString.nullValue;
	private String z3This = DBString.nullValue;
	private String z4This = DBString.nullValue;
	private String z5This = DBString.nullValue;
	private String z1Last = DBString.nullValue;
	private String z2Last = DBString.nullValue;
	private String z3Last = DBString.nullValue;
	private String z4Last = DBString.nullValue;
	private String z5Last = DBString.nullValue;
	
 
	public Summary(HashMap thisweek,HashMap lastweek) {
		this.durationThis = (String) thisweek.get("duration");
		this.distanceThis = (String) thisweek.get("distance");
		this.activitiesThis = (String) thisweek.get("activities");
		this.totalpointsThis = (Integer) thisweek.get("totalpoints");
		this.caloriesThis = (Integer) thisweek.get("calories");
		this.z1This = (String) thisweek.get("z1");
		this.z2This = (String) thisweek.get("z2");
		this.z3This = (String) thisweek.get("z3");
		this.z4This = (String) thisweek.get("z4");
		this.z5This = (String) thisweek.get("z5");
		
		this.durationLast = (String) lastweek.get("duration");
		this.distanceLast = (String) lastweek.get("distance");
		this.activitiesLast = (String) lastweek.get("activities");
		this.totalpointsLast = (Integer) lastweek.get("totalpoints");
		this.caloriesLast = (Integer) lastweek.get("calories");
		this.z1Last = (String) lastweek.get("z1");
		this.z2Last = (String) lastweek.get("z2");
		this.z3Last = (String) lastweek.get("z3");
		this.z4Last = (String) lastweek.get("z4");
		this.z5Last = (String) lastweek.get("z5");
	}

	public class durationLast_column extends Columns {
		public durationLast_column() {
			super("durationLast", "Duration", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.durationLast);
		}
	}
	
	public class durationThis_column extends Columns {
		public durationThis_column() {
			super("durationThis", "Duration", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.durationThis);
		}
	}

	public class distanceThis_column extends Columns {
		public distanceThis_column() {
			super("distanceThis", "Distance", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.distanceThis);
		}
	}
	
	public class distanceLast_column extends Columns {
		public distanceLast_column() {
			super("distanceLast", "Distance", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.distanceLast);
		}
	}
	
	public class activitiesLast_column extends Columns {
		public activitiesLast_column() {
			super("activitiesLast", "Activities", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.activitiesLast);
		}
	}

	public class activitiesThis_column extends Columns {
		public activitiesThis_column() {
			super("activitiesThis", "Activities", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.activitiesThis);
		}
	}
	
	public class z1This_column extends Columns {
		public z1This_column() {
			super("z1This", "Zone 1", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z1This);
		}
	}
	
	public class z2This_column extends Columns {
		public z2This_column() {
			super("z2This", "Zone 2", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z2This);
		}
	}
	
	public class z3This_column extends Columns {
		public z3This_column() {
			super("z3This", "Zone 3", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z3This);
		}
	}
	
	public class z4This_column extends Columns {
		public z4This_column() {
			super("z4This", "Zone 4", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z4This);
		}
	}
	
	public class z5This_column extends Columns {
		public z5This_column() {
			super("z5This", "Zone 5", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z5This);
		}
	}
	
	public class z1Last_column extends Columns {
		public z1Last_column() {
			super("z1Last", "Zone 1", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z1Last);
		}
	}
	
	public class z2Last_column extends Columns {
		public z2Last_column() {
			super("z2Last", "Zone 2", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z2Last);
		}
	}
	
	public class z3Last_column extends Columns {
		public z3Last_column() {
			super("z3Last", "Zone 3", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z3Last);
		}
	}
	
	public class z4Last_column extends Columns {
		public z4Last_column() {
			super("z4Last", "Zone 4", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z4Last);
		}
	}
	
	public class z5Last_column extends Columns {
		public z5Last_column() {
			super("z5Last", "Zone 5", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBString(row.z5Last);
		}
	}
	
	public class totalpointsThis_column extends Columns {
		public totalpointsThis_column() {
			super("totalpointsThis", "Points", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBInteger(row.totalpointsThis);
		}
	}
	
	public class totalpointsLast_column extends Columns {
		public totalpointsLast_column() {
			super("totalpointsLast", "Points", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBInteger(row.totalpointsLast);
		}
	}
	
	public class caloriesThis_column extends Columns {
		public caloriesThis_column() {
			super("caloriesThis", "Calories", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBInteger(row.caloriesThis);
		}
	}
	
	public class caloriesLast_column extends Columns {
		public caloriesLast_column() {
			super("caloriesLast", "Calories", false);
		}

		public IDBValue getCell(Summary row) {
			return new DBInteger(row.caloriesLast);
		}
	}
	
	private static ArrayList columns = new ArrayList();
	private static final Summary instance = new Summary();

	public abstract static class Columns extends DataColumn {

		public Columns(String name, String caption, boolean allowNull) {
			super(name, caption, allowNull);
			columns.add(this);
			this.order = columns.size();
		}

		public abstract IDBValue getCell(Summary row);

		public static final durationThis_column durationThis = instance.new durationThis_column();
		public static final distanceThis_column distanceThis = instance.new distanceThis_column();
		public static final activitiesThis_column activitiesThis = instance.new activitiesThis_column();
		public static final totalpointsThis_column totalpointsThis = instance.new totalpointsThis_column();
		public static final caloriesThis_column caloriesThis = instance.new caloriesThis_column();
		
		public static final durationLast_column durationLast = instance.new durationLast_column();
		public static final distanceLast_column distanceLast = instance.new distanceLast_column();
		public static final activitiesLast_column activitiesLast = instance.new activitiesLast_column();
		public static final totalpointsLast_column totalpointsLast = instance.new totalpointsLast_column();
		public static final caloriesLast_column caloriesLast = instance.new caloriesLast_column();
		
		public static final z1Last_column z1Last = instance.new z1Last_column();
		public static final z2Last_column z2Last = instance.new z2Last_column();
		public static final z3Last_column z3Last = instance.new z3Last_column();
		public static final z4Last_column z4Last = instance.new z4Last_column();
		public static final z5Last_column z5Last = instance.new z5Last_column();
		
		public static final z1This_column z1This = instance.new z1This_column();
		public static final z2This_column z2This = instance.new z2This_column();
		public static final z3This_column z3This = instance.new z3This_column();
		public static final z4This_column z4This = instance.new z4This_column();
		public static final z5This_column z5This = instance.new z5This_column();
		
		
		
		}

	public IDBValue getCell(IDataColumn column) {
		Columns col = (Columns) column;
		return col.getCell(this);
	}

	public IDataColumn getColumn(int index) {
		return (IDataColumn) columns.get(index);
	}

	public int getColumnCount() {
		return columns.size();
	}

	public void setCell(IDataColumn column, IDBValue value) {

	}


}
